﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using RestaurantBooker.Model;

namespace RestaurantBooker.Themes
{
    public class ThemeBrushes : BasePropertyChangedObject
    {
        private Brush _highlightedBrush;
        private Brush _homePageTextBrush2;
        private Brush _homePageTextBrush;
        private Brush _mainBackground;
        private Brush _headerBackground;
        private Brush _headerBorderBrush;
        private Brush _mainPanelBackground;

        /// <summary>
        /// Gets a Brush for SystemColors.AppWorkspaceColor.
        /// </summary>
        public Brush HighlightedBrush
        {
            get
            {
                if (_highlightedBrush == null)
                    _highlightedBrush = App.Current.Resources["HighlightedBrush"] as Brush;
                return _highlightedBrush;
            }
        }

        public Brush HomePageTextBrush
        {
            get
            {
                if (_homePageTextBrush == null)
                    _homePageTextBrush = App.Current.Resources["HomePageTextBrush"] as Brush;
                return _homePageTextBrush;
            }
        }

        public Brush HomePageTextBrush2
        {
            get
            {
                if (_homePageTextBrush2 == null)
                    _homePageTextBrush2 = App.Current.Resources["HomePageTextBrush2"] as Brush;
                return _homePageTextBrush2;
            }
        }

        public Brush MainBackground
        {
            get
            {
                if (_mainBackground == null)
                    _mainBackground = App.Current.Resources["MainBackground"] as Brush;
                return _mainBackground;
            }
        }
        
        public Brush HeaderBackground
        {
            get
            {
                if (_headerBackground == null)
                    _headerBackground = App.Current.Resources["HeaderBackground"] as Brush;
                return _headerBackground;
            }
        }

        public Brush HeaderBorderBrush
        {
            get
            {
                if (_headerBorderBrush == null)
                    _headerBorderBrush = App.Current.Resources["HeaderBorderBrush"] as Brush;
                return _headerBorderBrush;
            }
        }

        public Brush MainPanelBackground
        {
            get
            {
                if (_mainPanelBackground == null)
                    _mainPanelBackground = App.Current.Resources["MainPanelBackground"] as Brush;
                return _mainPanelBackground;
            }
        }
        

        public void ReloadBrushes()
        {
            _highlightedBrush = App.Current.Resources["HighlightedBrush"] as Brush;
            RaisePropertyChanged("HighlightedBrush");

            _homePageTextBrush = App.Current.Resources["HomePageTextBrush"] as Brush;
            RaisePropertyChanged("HomePageTextBrush");

            _homePageTextBrush = App.Current.Resources["HomePageTextBrush2"] as Brush;
            RaisePropertyChanged("HomePageTextBrush2");

            _mainBackground = App.Current.Resources["MainBackground"] as Brush;
            RaisePropertyChanged("MainBackground");

            _headerBackground = App.Current.Resources["HeaderBackground"] as Brush;
            RaisePropertyChanged("HeaderBackground");

            _headerBorderBrush = App.Current.Resources["HeaderBorderBrush"] as Brush;
            RaisePropertyChanged("HeaderBorderBrush");

            _mainPanelBackground = App.Current.Resources["MainPanelBackground"] as Brush;
            RaisePropertyChanged("MainPanelBackground");
        }
    }
}
